<template>
  <div class="flex flex-direction" style="height: 100%;">
    <checked-title title="最新案件"></checked-title>
    <div @click="workOrderDetails($event)">
      <vue-seamless-scroll :class-option="classOption" :data="scrollData" class="warp" ref="mySwiper">
        <ul>
          <li :key="'a' + index" v-for="(item, index) in scrollData">
            <div class="latest_case">
              <div class="latest_case_title">
                <p>{{ item.sourceTitle }}</p>
                <p>{{ item.staLink }}</p>
              </div>
              <div class="latest_case_text ellipsis2">{{ item.content }}</div>
              <div class="latest_case_weizhi">
                <p>{{ item.createTime }}</p>
                <p>
                  <span :data-item="JSON.stringify(item)">查看</span>
                </p>
              </div>
            </div>
          </li>
        </ul>
      </vue-seamless-scroll>
    </div>
  </div>
</template>

<script>
import vueSeamlessScroll from 'vue-seamless-scroll'
import Bus from '@/untils/bus'
import $ from 'jquery'

export default {
  components: {
    vueSeamlessScroll
  },
  props: {
    classOption: {
      type: Object,
      default: () => { }
    },
    scrollData: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      newList: []
    }
  },
  computed: {},
  methods: {
    // 工单详情
    workOrderDetails(e) {
      let obj = $(e.target).data('item')
      const data = {
        id: obj.orderNum
      }
      Bus.$emit('openDetail', data)
    }
  }
}
</script>

<style lang="less" scoped>
.swiper-container {
  height: 400px;
}

.swiper-slide {
  height: 180px !important;
}

.chunk_con {
  // height: calc(100% - 40px);
  height: 100%;
}

.warp {
  overflow: hidden;
}

.latest_case {
  width: 100%;
  background: rgba(31, 73, 135, 0.25);
  margin-top: 20px;

  // border: 1px solid rgba(35, 104, 255, 0.25);
  .latest_case_title {
    width: 100%;
    height: 40px;
    background: rgba(31, 73, 135, 0.8);
    border: 1px solid rgba(35, 104, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 18px;

    p:nth-child(1) {
      height: 20px;
      padding: 0 12px;
      background: #35cfe8;
      border-radius: 10px 10px 10px 0px;
      font-size: 12px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #ffffff;
      line-height: 20px;
    }

    p:nth-child(2) {
      font-size: 12px;
      font-family: Source Han Sans SC;
      font-weight: 400;
      color: #3cffff;
      line-height: 48px;
    }
  }

  .latest_case_text {
    width: 100%;
    padding: 16px 14px 13px 18px;
    max-height: 64px;
    overflow: hidden;
    font-size: 14px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #ffffff;
    line-height: 22px;
    word-wrap: break-word;
  }

  .latest_case_weizhi {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px 16px 18px;

    p:nth-child(1) {
      font-size: 12px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #9ed5ff;
    }

    p:nth-child(2) {
      height: 20px;
      background: rgba(31, 73, 135, 0.3);
      border: 1px solid #3cffff;
      border-radius: 10px;
      font-size: 12px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      padding: 0 15px;
      z-index: 99;

      span {
        color: #ffffff;
        cursor: pointer;
      }
    }
  }
}
</style>
